package org.dtrd.modules.patient.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.patient.entity.bean.PatientTagDetail;

import java.util.Date;


/**
 * <p>
 * 患者标签关系表
 * </p>
 *
 * @author QR
 * @since 2022-03-08
 */
@Getter
@Setter
@TableName("dtrd_rl_patient_tag")
public class DtrdRlPatientTag {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 标签id
     */
    @TableField("tag_id")
    private Integer tagId;

    /**
     * 患者id
     */
    @TableField("patient_id")
    private Integer patientId;

    @TableField("is_del")
    private Integer isDel;

    @TableField("create_time")
    private Date createTime;

    public DtrdRlPatientTag() {}

    public DtrdRlPatientTag(Integer patientId, Integer tagId) {
        this.patientId = patientId;
        this.tagId = tagId;
    }

    public DtrdRlPatientTag init() {
        isDel = 0;
        createTime = new Date();
        return this;
    }

    public DtrdRlPatientTag parseFromDTO(PatientTagDetail dto) {
        dataId = dto.getDataId();
        tagId = dto.getTagId();
        patientId = dto.getPatientId();
        return this;
    }


}
